package com.i2863.shiroDemo.dto;

import com.i2863.shiroDemo.entity.User;
import lombok.Data;

import java.util.Date;

/**
 * @author cexy
 * @date 2019/10/18 14:22
 * @description: 后台系统用户展示模型
 */
@Data
public class UserDto {

    private Integer id;
    private Integer roleId;
    private String roleName;
    private String name;
    private Integer state;
    private String userName;
    private Date updateTime;
    private Date createTime;

    public UserDto(User user) {
        this.id = user.getId();
        this.roleId = user.getRoleId();
        this.name = user.getName();
        this.state = user.getState();
        this.userName = user.getUserName();
        this.updateTime = user.getUpdateTime();
        this.createTime = user.getCreateTime();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        UserDto user = (UserDto) o;

        if (!id.equals(user.id)) {
            return false;
        }
        return roleId.equals(user.roleId);

    }
}
